package com.woniuxy.service.impl;

import com.woniuxy.dao.PersonDao;
import com.woniuxy.entity.Person;
import com.woniuxy.service.PersonService;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author 罗蔚
 * @Date 2022/3/29 11:18
 * @Description TODO
 */
public class PersonServiceImpl implements PersonService {
    PersonDao personDao;

    public void setPersonDao(PersonDao personDao) {
        this.personDao = personDao;
    }

    @Override
    public int addOne(Person person) {
        int i = personDao.addOne(person);
        int j = 1/0;
        return i;
    }

    @Override
    public List<Person> findAll() {
        return personDao.findAll();
    }

    @Override
    public int deleteOne(int id) {
        int i = personDao.deleteOne(id);
        //int j = 1/0;
        return i;
    }

    @Override
    @Transactional(propagation = Propagation.REQUIRED)
    public int updataOne(Person person) {
        int i = personDao.updataOne(person);
        int j = 1 / 0;
        return i;
    }


}
